// 使用react-router-config进行路由配置
import { lazy } from 'react'
import { Navigate } from 'react-router-dom'

// 动态导入，提高首屏加载速度
const Home = lazy(() => import('../views/homepage'))
const Login = lazy(() => import('../views/login'))
const Notfond = lazy(() => import('../views/notfond'))
const Catgory = lazy(() => import('../views/category'))
const Rank = lazy(() => import('../views/ranking'))
const Finish = lazy(() => import('../views/finishbook'))
const Library = lazy(() => import('../views/library'))

const routes = [
    {
        path: '/',
        element: <Navigate to="/home" />
    },
    {
        path: '/home',
        element: <Home />
    },
    {
        path:'/login',
        element: <Login />
    },
    {
        path:'/category',
        element: <Catgory />
    },
    {
        path:'/ranking',
        element: <Rank />
    },
    {
        path:'/finish',
        element: <Finish />
    },
    {
        path: '/library',
        element: <Library />
    },
    {
        path: '*',
        element: <Notfond />
    }
]

export default routes